package com.piggy.system.api.factory;

import com.piggy.system.api.RemoteRoleAuthcodeService;
import com.piggy.system.api.bo.SysRoleAuthcodeEditBo;
import com.piggy.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteRoleAuthcodeFallbackFactory implements FallbackFactory<RemoteRoleAuthcodeService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteRoleFallbackFactory.class);

    @Override
    public RemoteRoleAuthcodeService create(Throwable throwable) {
        log.error("角色服务调用失败:{}", throwable.getMessage());
        return new RemoteRoleAuthcodeService()
        {

            @Override
            public R<Boolean> updateBySceneIdAndBusinessId(SysRoleAuthcodeEditBo bo, String source) {
                return R.fail("角色服务调用失败:" + throwable.getMessage());
            }

        };
    }
}
